/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.appspot.trick.it.admin;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author takahara
 */
public class Constants {
    
    /**
     * アプリ名
     */
    public static final String APPLICATION_NAME = "Trick Admin";

    // -------------------------------------------------------------------------
    // OS
    // -------------------------------------------------------------------------
    /**
     * OS固有のファイルの区切り文字
     */
    public static final String FILE_SEPARATOR = System.getProperty("file.separator");
    /**
     * OS固有のuserのホームディレクトリ
     */
    public static final String USER_HOME_DIR_PATH = System.getProperty("user.home");
    /**
     * OS固有の改行コード
     */
    public static final String SYSTEM_CRLF = System.getProperty("line.separator");
    
    /**
     * アプリルートディレクトリ名
     */
    public static final String DIR_NAME_APPL_ROOT = ".trickadmin";
    
    /**
     * アプリケーションセキュアディレクトリパス
     */
    public static final String APP_SECRETS_DIR_PATH = USER_HOME_DIR_PATH
            + FILE_SEPARATOR
            + DIR_NAME_APPL_ROOT
            + FILE_SEPARATOR
            + "secrets";
    
    // -------------------------------------------------------------------------
    // DB
    // -------------------------------------------------------------------------
    
    /**
     * DB パス
     */
    public static final String DB_PATH = USER_HOME_DIR_PATH
            + FILE_SEPARATOR
            + DIR_NAME_APPL_ROOT
            + FILE_SEPARATOR
            + "db";
    /**
     * DB user
     */
    public static final String DB_USER = "trickadmin";
    /**
     * DB password
     */
    public static final String DB_PASSWORD = "trickadmin";
    
    
    // -------------------------------------------------------------------------
    // Google Drive
    // -------------------------------------------------------------------------
    /**
     * ドライブホストベースURL(定数)
     */
    public static final String GOOGLE_DRIVE_HOST_BASE_URL = "https://googledrive.com/host/";

    public static final String IMAGE_MAIN_MIME_TYPE = "image/png";
    public static final String IMAGE_MAIN_FILE_EXTENSION = ".png";
    
    
    public static final Map<String, String> GOOGLE_FILE_UNIQUE_MIME_TYPE =  new HashMap<String, String>() {
            {put("xls", "application/vnd.ms-excel");}
            {put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");}
            {put("msi", "application/x-msi");}
            {put("csv", "text/plain");}
            {put("jpg", "image/jpeg");}
            {put("png", "image/png");}
            {put("gif", "image/gif");}
        };
    
    public static enum GOOGLE_FILE_TYPES_ENUM {
        docs("application/vnd.google-apps.document"), 
        presentations("application/vnd.google-apps.presentation"), 
        spreadsheets("application/vnd.google-apps.spreadsheet"), 
        forms("application/vnd.google-apps.form"), 
        drawings("application/vnd.google-apps.drawing"), 
        folder("application/vnd.google-apps.folder");
        
        private final String mimeType;
        
        private GOOGLE_FILE_TYPES_ENUM(String mimeType) {
            this.mimeType = mimeType;
        }
        
        public String getMineType() {
            return this.mimeType;
        }
    };
    
    public static final List<String> CONVERT_TO_GOOGLE_DOCS_FILE_TYPES = 
            new ArrayList<>(
                    Arrays.asList(
                            "doc", 
                            "docx", 
                            "html",
                            "txt",
                            "rtf"));
    
    public static final List<String> CONVERT_TO_GOOGLE_SPREADSHEET_FILE_TYPES = 
            new ArrayList<>(
                    Arrays.asList(
                            "xls", 
                            "xlsx", 
                            "ods",
                            "csv",
                            "tsv",
                            "txt",
                            "tab"));
    
    public static final List<String> CONVERT_TO_GOOGLE_PRESENTATIONS_FILE_TYPES = 
            new ArrayList<>(
                    Arrays.asList(
                            "ppt", 
                            "pps", 
                            "pptx"));
    
    public static final List<String> CONVERT_TO_GOOGLE_DRAWINGS_FILE_TYPES = 
            new ArrayList<>(
                    Arrays.asList(
                            "wmf"));
    
    public static final List<String> CONVERT_TO_GOOGLE_OCR_FILE_TYPES = 
            new ArrayList<>(
                    Arrays.asList(
                            "jpg",
                            "gif",
                            "png",
                            "pdf"));
}
